﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace WeekExam.PassPort.Infrastructure.Interface
{
    /// <summary>
    /// 基础仓储接口
    /// </summary>
    /// <typeparam name="T">实体</typeparam>
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <returns>返回任务</returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 反填数据
        /// </summary>
        /// <param name="id">实体</param>
        /// <returns>返回任务</returns>
        Task<T> GetByAsync(Expression<Func<T,bool>> expression);
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="id">实体</param>
        /// <returns>返回任务</returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="id">实体</param>
        /// <returns>返回任务</returns>
        Task<int> UpdAsync(T entity);
    }
}
